package bean;

import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * 实现spring提供的init方法{@link InitializingBean#afterPropertiesSet()}
 * 和destroy{@link DisposableBean#destroy()}方法
 * @see InitializingBean
 * @see DisposableBean
 */
@Component
public class Cat implements InitializingBean, DisposableBean {
    public Cat() {
        System.out.println("cat construct...");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("cat destroy...");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("cat init....");
    }
}
